Add execution status and error reporting to aksarc_jumpstart scripts#447
Draft
Copilot wants to merge 5 commits into
Draft
Add execution status and error reporting to aksarc_jumpstart scripts#447Copilot wants to merge 5 commits into
Copilot wants to merge 5 commits into
Conversation
…messages Co-authored-by: madhanrm <20309044+madhanrm@users.noreply.github.com>
…uplication Co-authored-by: madhanrm <20309044+madhanrm@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update aksarc_jumpstart to return execution status and error message
Add execution status and error reporting to aksarc_jumpstart scripts
Jan 23, 2026
Replace ~150 lines of duplicated Write-Host status blocks in jumpstart.ps1 and deployaksarc.ps1 with two reusable helpers: - Write-ExecutionStatus: prints the status block (omits failure-only fields on success), mirroring the bash print_execution_status function. - Invoke-StepFailure: records FailedStep / ErrorMessage / ExitCode, prints the status block, and exits, mirroring the bash handle_error function. Behavior is unchanged: same status fields, same exit codes, same step names. Only structure is different. The PowerShell scripts now match the cleaner pattern already used in jumpstart.sh / deployaksarc.sh. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ROOT CAUSE 1 (silent failure): commandToExecute = 'powershell.exe -File X.ps1' completes with exit 0 even if the script wrote to Write-Error or otherwise failed without throwing. CustomScriptExtension reports Succeeded, ARM deployment returns 0, and the previous LASTEXITCODE / $? -ne 0 checks never fire. The script appears to succeed while actual deployment work failed. ROOT CAUSE 2 (dead error checks under set -e): jumpstart.sh and deployaksarc.sh use 'set -e' followed by 'az ...; if [[ $? -ne 0 ]]; then handle_error ...'. Under set -e, the script exits at the failed az call before the if check runs, so handle_error never executes and the EXECUTION STATUS block is never printed -- a loud ARM failure also dies silently. FIXES: 1. Extract status helpers into shared status-reporting.ps1 / status-reporting.sh dot-sourced from both scripts (removes ~150 lines of duplication). 2. New helper 'Invoke-VmScriptDeployment' (PS) / 'invoke_vm_script_deployment' (bash) ALWAYS queries the extension instance view after the deployment and treats ProvisioningState != succeeded as a failure, even when az deployment group create returned 0. On any failure it surfaces ProvisioningState message + StdOut + StdErr from the extension substatuses (instead of just 'az command failed with exit code N'). 3. Replace every 'cmd; if [[ $? -ne 0 ]]; then handle_error' with 'cmd || handle_error ... $?' so error handlers actually run under set -e. VALIDATION: Added three test harnesses that mock 'az' to exercise success, silent-failure, loud-failure, noisy-success, and instance-view-unfetchable scenarios -- plus an integration test that runs the helper under 'set -e' to verify the EXECUTION STATUS block is printed and the script exits non-zero on both ARM and silent-extension failures. Run with: pwsh -NoProfile -File aksarc_jumpstart/tests/Test-StatusReporting.ps1 bash aksarc_jumpstart/tests/test-status-reporting.sh bash aksarc_jumpstart/tests/test-integration-set-e.sh All 12 scenarios pass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The aksarc_jumpstart scripts lacked structured execution status reporting, making it difficult to identify which deployment step failed and troubleshoot issues.
Changes
All four scripts (
jumpstart.ps1,jumpstart.sh,deployaksarc.ps1,deployaksarc.sh) now:PowerShell implementation:
Bash implementation:
Example Output
On failure:
On success:
Implementation Details
handle_error()function$scriptBaseNamevariable indeployaksarc.ps1💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.